﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Criterion;

namespace FJASPX.Framwork.Web
{
    /// <summary>
    /// 排序器
    /// </summary>
    public class OrdersBuilder
    {
        private List<Order> orderList = new List<Order>();
        public OrdersBuilder Add(String sortProperty, String sortOrder)
        {
            if ("asc".Equals(sortOrder))
                Add(Order.Asc(sortProperty));
            else if ("desc".Equals(sortOrder)) Add(Order.Desc(sortProperty));
            return this;
        }

        public OrdersBuilder Add(Order order)
        {
            orderList.Add(order);
            return this;
        }

        public List<Order> ToList()
        {
            return orderList;
        }
    }
}
